package com.example.a28796.beautiful.stybean;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by lenovo on 2016/8/30.
 */
public class FuliBean {

    /**
     * code : 0
     * message : null
     * obj : {"modules":[{"liId":101,"title":"活动福利","type":101},{"liId":102,"title":"名医在线","type":102},{"liId":103,"title":"明星黛粉","type":103},{"liId":509011,"title":"新人签到","type":1,"articleGroup":{"gid":1039973}},{"liId":509012,"title":"贴心版规","type":1,"articleGroup":{"gid":154423}},{"liId":509010,"title":"意见反馈","type":1,"articleGroup":{"gid":565124}}],"carousels":[{"liId":573779,"cover":{"url":"http://fq1.img.meidaila.net/160811/FnbhYfBzBfD1tdK2mS2iMOI7lI_p.jpg","w":800,"h":280,"status":0,"desc":null,"extra":null},"type":1,"articleGroup":{"gid":3463231}}]}
     * now : 1472525863
     * sign : null
     */

    private int code;
    private Object message;
    private ObjBean obj;
    private int now;
    private Object sign;

    public static FuliBean objectFromData(String str) {

        return new Gson().fromJson(str, FuliBean.class);
    }

    public static FuliBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), FuliBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<FuliBean> arrayFuliBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<FuliBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<FuliBean> arrayFuliBeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<FuliBean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getMessage() {
        return message;
    }

    public void setMessage(Object message) {
        this.message = message;
    }

    public ObjBean getObj() {
        return obj;
    }

    public void setObj(ObjBean obj) {
        this.obj = obj;
    }

    public int getNow() {
        return now;
    }

    public void setNow(int now) {
        this.now = now;
    }

    public Object getSign() {
        return sign;
    }

    public void setSign(Object sign) {
        this.sign = sign;
    }

    public static class ObjBean {
        /**
         * liId : 101
         * title : 活动福利
         * type : 101
         */

        private List<ModulesBean> modules;
        /**
         * liId : 573779
         * cover : {"url":"http://fq1.img.meidaila.net/160811/FnbhYfBzBfD1tdK2mS2iMOI7lI_p.jpg","w":800,"h":280,"status":0,"desc":null,"extra":null}
         * type : 1
         * articleGroup : {"gid":3463231}
         */

        private List<CarouselsBean> carousels;

        public static ObjBean objectFromData(String str) {

            return new Gson().fromJson(str, ObjBean.class);
        }

        public static ObjBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), ObjBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<ObjBean> arrayObjBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<ObjBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<ObjBean> arrayObjBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<ObjBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public List<ModulesBean> getModules() {
            return modules;
        }

        public void setModules(List<ModulesBean> modules) {
            this.modules = modules;
        }

        public List<CarouselsBean> getCarousels() {
            return carousels;
        }

        public void setCarousels(List<CarouselsBean> carousels) {
            this.carousels = carousels;
        }

        public static class ModulesBean {
            private int liId;
            private String title;
            private int type;

            public static ModulesBean objectFromData(String str) {

                return new Gson().fromJson(str, ModulesBean.class);
            }

            public static ModulesBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), ModulesBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<ModulesBean> arrayModulesBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<ModulesBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<ModulesBean> arrayModulesBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<ModulesBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public int getLiId() {
                return liId;
            }

            public void setLiId(int liId) {
                this.liId = liId;
            }

            public String getTitle() {
                return title;
            }

            public void setTitle(String title) {
                this.title = title;
            }

            public int getType() {
                return type;
            }

            public void setType(int type) {
                this.type = type;
            }
        }

        public static class CarouselsBean {
            private int liId;
            /**
             * url : http://fq1.img.meidaila.net/160811/FnbhYfBzBfD1tdK2mS2iMOI7lI_p.jpg
             * w : 800
             * h : 280
             * status : 0
             * desc : null
             * extra : null
             */

            private CoverBean cover;
            private int type;
            /**
             * gid : 3463231
             */

            private ArticleGroupBean articleGroup;

            public static CarouselsBean objectFromData(String str) {

                return new Gson().fromJson(str, CarouselsBean.class);
            }

            public static CarouselsBean objectFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);

                    return new Gson().fromJson(jsonObject.getString(str), CarouselsBean.class);
                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return null;
            }

            public static List<CarouselsBean> arrayCarouselsBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<CarouselsBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public static List<CarouselsBean> arrayCarouselsBeanFromData(String str, String key) {

                try {
                    JSONObject jsonObject = new JSONObject(str);
                    Type listType = new TypeToken<ArrayList<CarouselsBean>>() {
                    }.getType();

                    return new Gson().fromJson(jsonObject.getString(str), listType);

                } catch (JSONException e) {
                    e.printStackTrace();
                }

                return new ArrayList();


            }

            public int getLiId() {
                return liId;
            }

            public void setLiId(int liId) {
                this.liId = liId;
            }

            public CoverBean getCover() {
                return cover;
            }

            public void setCover(CoverBean cover) {
                this.cover = cover;
            }

            public int getType() {
                return type;
            }

            public void setType(int type) {
                this.type = type;
            }

            public ArticleGroupBean getArticleGroup() {
                return articleGroup;
            }

            public void setArticleGroup(ArticleGroupBean articleGroup) {
                this.articleGroup = articleGroup;
            }

            public static class CoverBean {
                private String url;
                private int w;
                private int h;
                private int status;
                private Object desc;
                private Object extra;

                public static CoverBean objectFromData(String str) {

                    return new Gson().fromJson(str, CoverBean.class);
                }

                public static CoverBean objectFromData(String str, String key) {

                    try {
                        JSONObject jsonObject = new JSONObject(str);

                        return new Gson().fromJson(jsonObject.getString(str), CoverBean.class);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    return null;
                }

                public static List<CoverBean> arrayCoverBeanFromData(String str) {

                    Type listType = new TypeToken<ArrayList<CoverBean>>() {
                    }.getType();

                    return new Gson().fromJson(str, listType);
                }

                public static List<CoverBean> arrayCoverBeanFromData(String str, String key) {

                    try {
                        JSONObject jsonObject = new JSONObject(str);
                        Type listType = new TypeToken<ArrayList<CoverBean>>() {
                        }.getType();

                        return new Gson().fromJson(jsonObject.getString(str), listType);

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    return new ArrayList();


                }

                public String getUrl() {
                    return url;
                }

                public void setUrl(String url) {
                    this.url = url;
                }

                public int getW() {
                    return w;
                }

                public void setW(int w) {
                    this.w = w;
                }

                public int getH() {
                    return h;
                }

                public void setH(int h) {
                    this.h = h;
                }

                public int getStatus() {
                    return status;
                }

                public void setStatus(int status) {
                    this.status = status;
                }

                public Object getDesc() {
                    return desc;
                }

                public void setDesc(Object desc) {
                    this.desc = desc;
                }

                public Object getExtra() {
                    return extra;
                }

                public void setExtra(Object extra) {
                    this.extra = extra;
                }
            }

            public static class ArticleGroupBean {
                private int gid;

                public static ArticleGroupBean objectFromData(String str) {

                    return new Gson().fromJson(str, ArticleGroupBean.class);
                }

                public static ArticleGroupBean objectFromData(String str, String key) {

                    try {
                        JSONObject jsonObject = new JSONObject(str);

                        return new Gson().fromJson(jsonObject.getString(str), ArticleGroupBean.class);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    return null;
                }

                public static List<ArticleGroupBean> arrayArticleGroupBeanFromData(String str) {

                    Type listType = new TypeToken<ArrayList<ArticleGroupBean>>() {
                    }.getType();

                    return new Gson().fromJson(str, listType);
                }

                public static List<ArticleGroupBean> arrayArticleGroupBeanFromData(String str, String key) {

                    try {
                        JSONObject jsonObject = new JSONObject(str);
                        Type listType = new TypeToken<ArrayList<ArticleGroupBean>>() {
                        }.getType();

                        return new Gson().fromJson(jsonObject.getString(str), listType);

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    return new ArrayList();


                }

                public int getGid() {
                    return gid;
                }

                public void setGid(int gid) {
                    this.gid = gid;
                }
            }
        }
    }
}
